<?php if ( ! have_posts() ) : ?>
	<div id="post-0" class="post error404 not-found">
		<h1 class="entry-title"><?php _e( 'Not Found', 'overall' ); ?></h1>
		<div class="entry-content">
			<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'overall' ); ?></p>
			<?php get_search_form(); ?>
		</div><!-- .entry-content -->
	</div><!-- #post-0 -->
<?php endif; ?>


<?php while ( have_posts() ) : the_post(); ?>

<?php /* How to display posts in the Gallery category. */ ?>

	<?php if ( in_category( _x('gallery', 'gallery category slug', 'overall') ) ) : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
			<h3 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'overall' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>

			<div class="entry-meta">
				<?php //overall_posted_on(); ?>
			</div><!-- .entry-meta -->

			<div class="entry-content">
<?php if ( post_password_required() ) : ?>
				<?php the_content(); ?>
				
<?php else : ?>			
				<?php 
					$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
					if ( $images ) :
						$total_images = count( $images );
						$image = array_shift( $images );
						$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
				?>
						<div class="gallery-thumb">
							<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
						</div><!-- .gallery-thumb -->
						<p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'overall' ),
								'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'overall' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
								$total_images
							); ?></em></p>
				<?php endif; ?>
						<?php the_excerpt(); ?>
<?php endif; ?>
			</div>

			<div class="entry-utility">
				<a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'overall'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'overall' ); ?>"><?php _e( 'More Galleries', 'overall' ); ?></a>
				<span class="meta-sep">|</span>
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'overall' ), __( '1 Comment', 'overall' ), __( '% Comments', 'overall' ) ); ?></span>
				<?php edit_post_link( __( 'Edit', 'overall' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
			</div>
		</div>


	<?php elseif ( in_category( _x('asides', 'asides category slug', 'overall') ) ) : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

		<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
			<div class="entry-summary">
				<?php the_excerpt(); ?>
			</div><!-- .entry-summary -->
		<?php else : ?>
			<div class="entry-content">
				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'overall' ) ); ?>
				
			</div>
		<?php endif; ?>

			<div class="entry-utility">
				<span class="meta-sep">|</span>
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'overall' ), __( '1 Comment', 'overall' ), __( '% Comments', 'overall' ) ); ?></span>
				<?php edit_post_link( __( 'Edit', 'overall' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
			</div><!-- .entry-utility -->
		</div><!-- #post-## -->

	<?php else : ?>
		<div  class="blog_container" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		
		
		<div class="blog_head">
						<div class="blog_title">
								<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
						</div>
						<div class="cleardiv"></div>
							
						<div class="blog_info">	
							<ul>
								<li class="date_icon"><?php the_time('M j, Y'); ?></li>
								<li class="written_by">by <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author() ?></a></li>
								<?php 
								$category = get_the_category(); 
								if($category[0]->cat_name){
								?>
								<li class="category"><?php the_category(', ') ?></li>
								<?php } ?>
								<li class="comment_icon"><?php comments_popup_link(get_option('cf_no_comments', 'No Comments').' &#187;', get_option('cf_one_comment', 'One Comment').' &#187;', '% '.get_option('cf_one_comments', 'Comments').' &#187;', 'commentslink', get_option('cf_off_comments', 'Comments Off')); ?></li>
							</ul>
							<?php if(get_the_tags()){ ?>
							<div class="blog_tag">
								<?php the_tags('<ul><li>',',</li><li>','</li></ul>'); ?>
							</div>
							<?php } ?>
						</div>
					</div>
		

	<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
			<div class="entry-summary">
				<?php the_excerpt(); ?>
			</div>
	<?php else : ?>
			<div class="entry-content">
				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'overall' ) ); ?>
			</div>
	<?php endif; ?>

							<div class="search_detail_button">
								<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
									<span class="search_detail_button">
										<?php echo get_option('blog_read_more', 'Read more &#187;'); ?>
									</span>
								</a>
							</div>
			
		</div>

		<?php comments_template( '', true ); ?>

	<?php endif; ?>

<?php endwhile; ?>
